package com.test.pack1.demo.base1_4;

import edu.princeton.cs.algs4.In;
import edu.princeton.cs.algs4.StdOut;

/**
 * Created by dws on 2017/11/15.
 */
public class ThreeSum {
    public static int count(int[] a){
        int N = a.length;
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i+1; j < N; j++) {
                for (int k = j+1; k < N; k++) {
                    if(a[i]+a[j]+a[k]==0){
                        cnt++;
                    }
                }
            }
        }
        return cnt;
    }
}
